// 加载VUE模块
import Vue from 'vue';
// 加载路由模块  vue-router
import VueRouter from 'vue-router';

//加载组件文件
import Index from '../views/index.vue';
import Home from '../views/home.vue';
import Info from '../views/info.vue';
import My from '../views/my.vue';
import Detail from '../views/detail.vue';
import Appoint from '../views/appoint.vue';
import Entry from '../views/entry.vue';
import InfoMore from '../views/infoMore.vue';


//框架应用路由对象
Vue.use(VueRouter);

//配置路由(就是配置访问路径url)

const routes = [{
        //程序入口页
        path: '/',
        name: 'Entry',
        //首页组件文件
        component: Entry,
        meta: {
            title: '相符租房'
        }
    },
    {
        //首页
        path: '/index',
        name: 'index',
        //首页组件文件
        component: Index,
        meta: {
            title: '首页',
            keepAlive: true
        }
    }, {
        path: '/home',
        name: 'home',
        component: Home,
        meta: {
            title: '房源',
            keepAlive: true
        }
    }, {
        path: '/info',
        name: 'info',
        component: Info,
        meta: {
            title: '咨询',
            keepAlive: true
        }
    },
    {
        path: '/infoMore',
        name: 'infoMore',
        component: InfoMore,
        meta: {
            title: '咨询更多',
            keepAlive: true
        }
    },
    {
        path: '/my',
        name: 'my',
        component: My,
        meta: {
            title: '咨询',
            keepAlive: true
        }
    },
    {
        path: '/detail/:hid',
        name: 'detail',
        component: Detail,
        meta: {
            title: '房源详情页',
            keepAlive: false
        }
    },
    {
        path: '/appoint/:hid',
        name: 'appoint',
        component: Appoint,
        meta: {
            title: '房源预约页',
            keepAlive: false
        }
    }
];

//实例化路由对象Vue-Router，得到路由对象
const router = new VueRouter({
    routes,
    linkExactActiveClass: 'active'
});

//默认输出一次
export default router;